<?php

/**
 * This is the model class for table "tbl_resp_ges_respuest".
 *
 * The followings are the available columns in table 'tbl_resp_ges_respuest':
 * @property integer $res_id
 * @property string $res_codigo
 * @property string $res_resp
 * @property string $res_resp_modulos
 * @property string $res_tipobol
 * @property string $res_posgrid
 * @property string $res_pregunta
 * @property string $res_column
 * @property string $res_nivel
 * @property string $res_respnum
 * @property string $res_resptext
 * @property string $res_fecha
 * @property string $res_usuarios
 * @property integer $res_estado
 */
class tbl_resp_ges_respuest extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return tbl_resp_ges_respuest the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_resp_ges_respuest';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('res_codigo, res_resp, res_resp_modulos, res_tipobol, res_pregunta, res_nivel, res_fecha, res_usuarios, res_estado', 'required'),
			array('res_estado', 'numerical', 'integerOnly'=>true),
			array('res_posgrid', 'length', 'max'=>10),
			array('res_codigo', 'length', 'max'=>15),
			array('res_resp, res_pregunta', 'length', 'max'=>7),
			array('res_resp_modulos, res_respnum', 'length', 'max'=>10),
			array('res_tipobol', 'length', 'max'=>4),			
			array('res_column', 'length', 'max'=>200),
			array('res_resptext', 'length', 'max'=>200),
			array('res_nivel', 'length', 'max'=>6),
			array('res_usuarios', 'length', 'max'=>5),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('res_id, res_codigo, res_resp, res_resp_modulos, res_tipobol, res_posgrid, res_pregunta, res_column, res_nivel, res_respnum, res_resptext, res_fecha, res_usuarios, res_estado', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'respMain'=>array(self::BELONGS_TO, 'tbl_resp', array('res_resp'=>'rma_codigo'))
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'res_id' => 'Res',
			'res_codigo' => 'Res Codigo',
			'res_resp' => 'Res Resp',
			'res_resp_modulos' => 'Res Resp Modulos',
			'res_tipobol' => 'Res Tipobol',
			'res_posgrid' => 'Res Posgrid',
			'res_pregunta' => 'Res Pregunta',
			'res_column' => 'Res Column',
			'res_nivel' => 'Res Nivel',
			'res_respnum' => 'Res Respnum',
			'res_resptext' => 'Res Resptext',
			'res_fecha' => 'Res Fecha',
			'res_usuarios' => 'Res Usuarios',
			'res_estado' => 'Res Estado',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('res_id',$this->res_id);

		$criteria->compare('res_codigo',$this->res_codigo,true);

		$criteria->compare('res_resp',$this->res_resp,true);

		$criteria->compare('res_resp_modulos',$this->res_resp_modulos,true);

		$criteria->compare('res_tipobol',$this->res_tipobol,true);

		$criteria->compare('res_posgrid',$this->res_posgrid,true);

		$criteria->compare('res_pregunta',$this->res_pregunta,true);

		$criteria->compare('res_column',$this->res_column,true);

		$criteria->compare('res_nivel',$this->res_nivel,true);

		$criteria->compare('res_respnum',$this->res_respnum,true);

		$criteria->compare('res_resptext',$this->res_resptext,true);

		$criteria->compare('res_fecha',$this->res_fecha,true);

		$criteria->compare('res_usuarios',$this->res_usuarios,true);

		$criteria->compare('res_estado',$this->res_estado);

		return new CActiveDataProvider('tbl_resp_ges_respuest', array(
			'criteria'=>$criteria,
		));
	}
}